package kr.hkit.PowerJava.chapter12.InterPackage;

public class Box implements Comparable {
	private double volume;

	public Box(double volume) {
		this.volume = volume;
	}

	public int compareTo(Object other) {
		return (int) (this.volume - ((Box) other).volume);
	}

	public static void main(String[] args) {
		Box b1 = new Box(100);
		Box b2 = new Box(185.0);

		if (b1.compareTo(b2) > 0) {
			System.out.println("b1이 큼");
		} else if (b1.compareTo(b2) < 0) {
			System.out.println("b2가 큼");
		} else {
			System.out.println("b1 과 b2 같음");
		}
	}

}
